<?php
namespace app\index\controller;

class Hits extends Base{
  public function views(){
    $id = input('param.id');
    $hitsid = 'c-3-'.$id;
    db('hits')->where("hitsid='$hitsid'")->setInc('views');
    $data = db('hits')->where("hitsid='$hitsid'")->find();
    $views = $data['views'];
    $html = <<<EOF
      layui.use('jquery',function(){
        var \$ = layui.jquery;

        $('#hits').text($views);
      });
EOF;
    echo $html;
  }
}
